﻿<%@ Page Title="Details" Language="C#" MasterPageFile="~/Posts/Posts.master" AutoEventWireup="true" CodeFile="Details.aspx.cs" Inherits="Posts_Details" %>
<%@ Register Src="Header.ascx" TagPrefix="uc" TagName="Header"  %>
<%@ Register Src="Menu.ascx" TagPrefix="uc" TagName="Menu"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="phHead" Runat="Server">
<script type="text/javascript">

    $(document).ready(function() {

        $("#ctl00_ctl00_phMain_phMain_dvDetails_0_0_txt").blur(function() {
            var txtUrl = $("#ctl00_ctl00_phMain_phMain_dvDetails_0_1_txt");
            if (txtUrl.val() == "~")
                return;
            var Url = $(this).val()
            // remove leading and trailing " "
            Url = Url.replace(/^\s+/gi, "");
            Url = Url.replace(/\s+$/gi, "");

            // remove non alphanum, hypen, underscores
            Url = Url.replace(/[^a-zA-Z0-9_\-\s]/gi, "");

            // replace " " with ""
            Url = Url.replace(/\s/gi, "-");

            // remove multiple "-"
            Url = Url.replace(/-{2,}/gi, "-");
            txtUrl.val(Url);
        });
    });
    
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="phMain" Runat="Server">
    <uc:Header id="ucHeader" runat="server" />
    <asp:Panel ID="Panel1" CssClass="tabPage clearfix" runat="server">
        <div class="actionButtons clearfix">
            <div class="floatRight">
                <acms:ActionButton ID="lnkEdit" Text="Edit" ToolTip="Edit The Nodes Details." Icon="Edit" runat="server" onclick="lnkEdit_Click"/>
                <acms:ActionButton ID="lnkSave" Text="Save" ToolTip="Save Changes." Icon="Save" runat="server" onclick="lnkSave_Click"/>
                <acms:ActionButton ID="lnkCancel" Text="Cancel" ToolTip="Cancel Changes." Icon="Cancel" onclick="lnkCancel_Click" runat="server"/>
            </div>
        </div>
        
        <asp:DetailsView ID="dvDetails" DataKeyNames="Id,ConcurencyId" runat="server" AutoGenerateRows="False" DataSourceID="dsPost" CssClass="XXXXoo">
            <Fields>
                <acms:TextBoxField DataField="DisplayName" HeaderText="Display Name" Required="true" HelpText="The name of this new Post. This is how it will appear in page titles, menus etc."  />
                <acms:TextBoxField DataField="Name" HeaderText="URL Safe Name" ReadOnly="true" Required="true" HelpText="The URL-safe name for this Post, e.g. ~/parentpath/<b><i>Name</i></b>. It can be set automatically if you enter a Display Name above." />
                <acms:DropDownField HeaderText="Template" ReadOnly="true" DataField="TemplateId" DisplayField="TemplateName" DataSourceId="dsTemplates" DataTextField="Name" DataValueField="Id" Required="True" RequiredValidationGroup="gvDetails" HasEmptyValue="True" runat="server" HelpText="Select the template you want this new Post to use." />
                <acms:TextAreaField Rows="10" Cols="50" HeaderText="Title Summary" DataField="TitleSummary" HelpText="Html Title Summary" />
                <acms:TextAreaField Rows="4" Cols="50" HeaderText="Meta Keywords" DataField="MetaKeywords" runat="server" HelpText="Meta Keywords for search engines." />
                <acms:TextAreaField HeaderText="Notes" DataField="Notes" Rows="10" Cols="50" runat="server" HelpText="Notes allow you to leave comments about this Post for other users of the CMS to read." />
                <acms:CheckBoxField HeaderText="Developer Locked" DataField="DeveloperLocked" ReadOnly="true" runat="server" />
            </Fields>
        </asp:DetailsView>
    </asp:Panel>
    <acms:TemplateDataSource ID="dsTemplates" runat="server" OnSelectData="dsTemplates_SelectData"/>
    <acms:PostDataSource ID="dsPost" runat="server" EnablePaging="False" 
        onselectdata="dsPost_SelectData" onupdatingdata="dsPost_UpdatingData"/>
</asp:Content>

